package Problem03;

import java.util.HashMap;
import java.util.Set;

public class NumberCounter {
    public static void main(String[] args) {
        String str1="123,456,789,123,456";
        String[] strArray=str1.split(",");
        HashMap<String,Integer> hashMap=new HashMap<String,Integer>();

        for(int i=0;i<strArray.length;i++){
            String key=strArray[i];

            if(hashMap.containsKey(key)){
                Integer value=hashMap.get(key);
                value++;
                hashMap.put(key,value);

            }
            else{
                hashMap.put(key,1);
            }
        }
        Set<String> s1=hashMap.keySet();
        for (String ts:s1
             ) {
            System.out.println(ts+"出现了"+hashMap.get(ts)+"次");
        }
    }

}
